<script src="plugin/qt_plyr/plyr/jquery.hotkeys.min.js"></script>
  <script src="plugin/qt_plyr/plyr/plyr.polyfilled.min.js"></script>
<script>
function loadCSS(filename) {
		// 判断重复加载
		var tags = document.getElementsByTagName('link');
		for(var i=0; i<tags.length; i++) {
			if(tags[i].href.indexOf(filename) != -1) {
				return false;
			}
		}
		var link = document.createElement("link");
		link.rel = "stylesheet";
		link.type = "text/css";
		link.href = filename;
		document.getElementsByTagName('head')[0].appendChild(link);
	}
if(document.querySelector('audio')) {
loadCSS('plugin/qt_plyr/plyr/plyr.css');
var player = new Plyr('audio', {
autoplay: true,
i18n: {
    restart: '重新开始',
    rewind: '后退 {seektime} 秒',
    play: '播放',
    pause: '暂停',
    fastForward: '快进 {seektime} 秒',
    seek: '进度',
    played: 'Played',
    buffered: '缓冲',
    currentTime: '当前时间',
    duration: '持续',
    volume: '音量',
    mute: '静音',
    unmute: '取消静音',
    enableCaptions: '启用字幕',
    disableCaptions: '禁用字幕',
    enterFullscreen: '进入全屏',
    exitFullscreen: '退出全屏',
    frameTitle: 'Player for {title}',
    captions: '字幕',
    settings: '设置',
    speed: '速度',
    normal: '正常',
    quality: '品质',
    loop: '循环',
    start: '开始',
    end: '结束',
    all: '全部',
    reset: '重置',
    disabled: 'Disabled',
    advertisement: '广告',
}
});
player.on('ended', function() {
location.href = "{:U('Program/'.$next_id)}";
});
$(document).on('keydown', null, 'esc', function(e) {
if(player) {
player.pause();
}
});
$(document).on('keydown', null, 'space', function(e) {

if(e.target.tagName != 'BUTTON' && player) {
player.togglePlay();
}
});

$(document).on('keydown', null, 'shift+right', function(e) {
if(player) {
player.forward();
}
});
$(document).on('keydown', null, 'shift+left', function(e) {
if(player) {
player.rewind();
}
});
$(document).on('keydown', null, 'shift+up', function(e) {
if(player) {
player.volume = player.volume + 0.05;
}
});
$(document).on('keydown', null, 'shift+down', function(e) {
if(player) {
player.volume = player.volume - 0.05;
}
});
}
</script>
